﻿CREATE PROCEDURE [dbo].[ReportWRQSummary]

AS
BEGIN
	SELECT Customer.CustomerName, Projects.Name, Users.FullName, EntryLog.EntryDate, EntryLog.Description, EntryLog.Duration
	FROM  EntryLog INNER JOIN
				   Users ON EntryLog.UserID = Users.UserID INNER JOIN
				   Projects ON EntryLog.ProjectID = Projects.ProjectID LEFT OUTER JOIN
				   CustomerProject ON CustomerProject.ProjectID = Projects.ProjectID LEFT OUTER JOIN
				   Customer ON Customer.CustomerID = CustomerProject.CustomerID
	WHERE (EntryLog.EntryDate >= DATEADD(dd, DATEDIFF(dd, 0, DATEADD(dd, - 6, GETDATE())), 0)) AND (Customer.CustomerID = 10)
	ORDER BY Customer.CustomerName, Projects.Name, Users.UserName, EntryLog.EntryDate
END

